<?php

	/**
	* 
	*/
	class User_model extends CI_Model
	{
		
		function __construct()
		{
			$this->load->database();
		}
		/*根据用户id获取用户信息*/
		function getUser($userId = FALSE)
		{
			if ($userId === FALSE)
		    {
		        $query = $this->db->get('login');
		        return $query->result_array();
		    }
		    //如果有活动id
		    $query = $this->db->get_where('login', array('userId' => $userId));
		    return $query->row_array();
		}
		/*添加新用户，用途：？*/
		function addUser($data)
		{
			$this->db->insert('login',$data);
		}
		//登陆判定和管理员判定
		function loginJudge($userId)
		{
			$query=$this->db->get_where('login',array('userId'=>$userId));
			return $query->row_array();
		}
		function masterjudge()
		{
			$master=1;
			$query=$this->db->get_where('login',array('master'=>$master));
			return $query;
		}
	}